package com.ccys.db.enums;

/**
 * @ClassName: DurationEnum
 * @Description:
 * @Author: billyhu
 * @Date: 2024/2/23 16:57
 */
public enum DurationEnum {

    DAY(0,"day(s)"),
    WEEK(1,"week(s)"),
    MONTH(2,"month(s)"),
    YEAR(3,"year(s)");

    private Integer key;
    private String value;

    DurationEnum(Integer key, String value) {
        this.key = key;
        this.value = value;
    }

    public Integer getKey() {
        return key;
    }

    public String getValue() {
        return value;
    }

    public static String getName(Integer key) {
        for (DurationEnum e : values()) {
            if (e.getKey() == key) {
                return e.getValue();
            }
        }
        return null;
    }
}
